package javaClassExercise.designPatterns.decoratorModel;

/**
 * Created by lomo .
 *
 * 装饰类，装饰类中必须含有被装饰类的实例对象
 *
 * Decorator类为Source类的实例对象增加功能
 *
 */
public class Decorator implements Sourceable{
    //被装饰类的对象
    private Sourceable source;

    public Decorator(Sourceable source) {
        //super();
        this.source = source;
    }

    @Override
    public void method() {

        System.out.println("装饰类的方法！！");
        source.method();
        System.out.println("decorated之后! ");
    }

    public void method2() {
        System.out.println("装饰类的另一个方法！！");
    }
}
